package com.cheng.example.java.basics;

public class StringDemo {

    public static void main(String[] args) {

        String s = "abac";
        System.out.println(s.charAt(0));
        System.out.println(s.replace("a","q"));
        System.out.println(s.replaceAll("a","q"));
        String Str = new String("www.google.com");
        System.out.print("匹配成功返回值 :" );
        System.out.println(Str.replaceAll("(.*)google(.*)", "runoob" ));
        System.out.print("匹配失败返回值 :" );
        System.out.println(Str.replaceAll("(.*)taobao(.*)", "runoob" ));
        System.out.println(s.indexOf(1));
        System.out.println(s.substring(1));


    }
}
